package org.imaginedays.androidall.ui;

import org.imaginedays.androidall.R;
import org.imaginedays.androidall.app.AndroidAllApp;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class AlertDialogACT extends Activity implements OnClickListener{
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.alertdialog);
		
		findViewById(R.id.btn_alertdialog).setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_alertdialog:
			createDialog();
			break;

		default:
			break;
		}
	}

	private void createDialog() {
		new AlertDialog.Builder(this).setTitle(R.string.alertDialog_title).setMessage(R.string.message).setNegativeButton(R.string.cancel, listener).setNeutralButton(R.string.hide, listener).setPositiveButton("ok", listener).setOnCancelListener(onCancelListener).show();
	}
	
	
	DialogInterface.OnClickListener  listener = new DialogInterface.OnClickListener() {
		
		@Override
		public void onClick(DialogInterface dialog, int which) {
			
			Log.e(AndroidAllApp.TAG, "which: "+which);
			
		}
	};
	
	DialogInterface.OnCancelListener onCancelListener = new DialogInterface.OnCancelListener() {
		
		@Override
		public void onCancel(DialogInterface dialog) {
			Log.e(AndroidAllApp.TAG, "onCancel");
		}
	};
	

}
